package com.example.zxc;

import android.content.Context;
import android.content.SharedPreferences;

public class denglu {//saveUserInfo方法保存数据到data.xml文件

    public static boolean saveUserInfo(Context context, String name, String password) {
        SharedPreferences sp = context.getSharedPreferences("data1", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sp.edit();
        editor.putString(name, password);
        editor.commit();
        return true;
        //注册
    }

    public static String getUserInfo(Context context, String name) {
        SharedPreferences sp = context.getSharedPreferences("data1", Context.MODE_PRIVATE);
        String password = sp.getString(name, null);
        return password;
        //denglu
    }
}